package com.itheima.a06bigIntegerdemo01;

import java.math.BigInteger;

/***
 *@title BigInteger
 *@description <TODO description class purpose>
 *@author 12468
 *@version 1.0.0
 *@create 2024-11-28 2:04
 **/
public class BigIntegerDemo02 {
    public static void main(String[] args) {

        BigInteger bd1 = new BigInteger("10");
        BigInteger bd2 = new BigInteger("5");

        // 加法
        BigInteger bd3 = bd1.add(bd2);
        System.out.println(bd3);

        // 减法
        BigInteger bg5 = bd1.subtract(bd2);
        System.out.println(bg5);

        // 除法
        BigInteger bd6 = bd1.divide(bd2);
        System.out.println(bd6);

        // 除法、获取商和余数
        BigInteger[] bds = bd1.divideAndRemainder(bd2);
        System.out.println(bds[0]);
        System.out.println(bds[1]);

        // 比较谁否相同
        System.out.println(bd1.equals(bd2));

        // 幂
        BigInteger bd4 = bd1.pow(2);
        System.out.println(bd4);

        // 最大值
        BigInteger max = bd1.max(bd2);
        System.out.println(max);
        System.out.println(max == bd1); // true
    }

}
